﻿<UserControl x:Class="ScrumFactory.Backlog.IterationPlanning"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:system="clr-namespace:System;assembly=mscorlib"
             xmlns:props="clr-namespace:ScrumFactory.Backlog.Properties"
             xmlns:SF="clr-namespace:ScrumFactory;assembly=ScrumFactory"   
             xmlns:SF_Comp="clr-namespace:ScrumFactory.Composition;assembly=ScrumFactory.Composition"                             
             xmlns:SF_Adorners="clr-namespace:ScrumFactory.Windows.Helpers.Adorners;assembly=ScrumFactory.Windows.Helpers"
             xmlns:SF_Helpers="clr-namespace:ScrumFactory.Windows.Helpers;assembly=ScrumFactory.Windows.Helpers"
             xmlns:SF_DD="clr-namespace:ScrumFactory.Windows.Helpers.DragDrop;assembly=ScrumFactory.Windows.Helpers"
             xmlns:SF_Converters="clr-namespace:ScrumFactory.Windows.Helpers.Converters;assembly=ScrumFactory.Windows.Helpers"
                        
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             
             
             x:Name="thisView">
    
    <UserControl.Resources>




        <Style x:Key="SprintHeaderBorder" TargetType="{x:Type Border}">
            <Setter Property="Border.CornerRadius" Value="4,4,0,0"/>
            <Setter Property="Border.BorderThickness" Value="0"/>
            <Setter Property="Border.Margin" Value="0"/>
            <Setter Property="Border.Padding" Value="3"/>
            <Setter Property="Border.Width" Value="120"/>
            <Setter Property="Border.Height" Value="80"/>
            <Setter Property="Border.Background" Value="#FAFAFA"/>
            
        </Style>

        <Style x:Key="SprintHeaderExpander" TargetType="{x:Type Expander}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">                        
                        <StackPanel Orientation="Horizontal">                                                           
                        <ContentPresenter x:Name="Content"/>
                        <ToggleButton                                     
                                MinWidth="8"
                                VerticalAlignment="Top"
                                Height="85"
                                IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                            <ToggleButton.Template>
                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                    <Grid Background="Transparent" Cursor="Hand">                                            
                                        <Polygon   
                                            VerticalAlignment="Top" HorizontalAlignment="Center"
                                            Margin="0,3,0,0"
                                            x:Name="arrow1"
                                            Points="0,5 5,0 5,10">
                                            <Polygon.Fill>
                                                <SolidColorBrush Color="{StaticResource Green3Color}"/>
                                            </Polygon.Fill>
                                        </Polygon>
                                        <Border
                                            x:Name="border"
                                            VerticalAlignment="Top" HorizontalAlignment="Center"
                                            Width="10"
                                            Margin="0,0,2,0"
                                            Style="{StaticResource SprintHeaderBorder}"/>
                                    </Grid>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsChecked" Value="True">
                                            <Setter TargetName="border" Property="Visibility" Value="Collapsed"/>                                               
                                            <Setter TargetName="arrow1" Property="Visibility" Value="Visible"/>
                                        </Trigger>
                                        <Trigger Property="IsChecked" Value="False">
                                            <Setter TargetName="border" Property="Visibility" Value="Visible"/>                                                
                                            <Setter TargetName="arrow1" Property="Visibility" Value="Collapsed"/>
                                        </Trigger>
                                        <Trigger Property="IsMouseOver" Value="True">                                                
                                            <Setter TargetName="arrow1" Property="Visibility" Value="Visible"/>
                                        </Trigger>
                                        <Trigger Property="IsMouseOver" Value="False">                                                
                                            <Setter TargetName="arrow1" Property="Visibility" Value="Collapsed"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </ToggleButton.Template>
                            <ToggleButton.Style>
                                <Style>
                                    <Style.Triggers>
                                        <Trigger Property="ToggleButton.IsChecked" Value="True">
                                            <Setter Property="ToggleButton.IsTabStop" Value="False"/>
                                            <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Local"/>
                                        </Trigger>
                                        <Trigger Property="ToggleButton.IsChecked" Value="False">
                                            <Setter Property="ToggleButton.IsTabStop" Value="True"/>
                                            <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="None"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </ToggleButton.Style>

                        </ToggleButton>
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="True">
                            <Setter TargetName="Content" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsExpanded" Value="False">
                            <Setter TargetName="Content" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

        

        <Style x:Key="SprintDatePicker" TargetType="{x:Type Calendar}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Calendar}">
                        <Grid>
                            
                            <ToggleButton x:Name="openButton">
                                <ToggleButton.Template>
                                    <ControlTemplate>
                                        <TextBlock
                                            Cursor="Hand"                                       
                                            Foreground="{StaticResource LinkBrush}"
                                            FontWeight="{TemplateBinding FontWeight}" FontSize="{TemplateBinding FontSize}"
                                            Text="{Binding ElementName=calendar, Path=SelectedDate, StringFormat='{}{0:d MMM}'}">
                                            <TextBlock.Style>
                                                <Style>
                                                    <Style.Triggers>
                                                        <Trigger Property="TextBlock.IsMouseOver" Value="True">
                                                            <Setter Property="TextBlock.TextDecorations" Value="underline"/>
                                                        </Trigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </TextBlock.Style>
                                        </TextBlock>

                                    </ControlTemplate>
                                </ToggleButton.Template>
                            </ToggleButton>
                            <Popup x:Name="popup" AllowsTransparency="True" IsOpen="{Binding ElementName=openButton, Path=IsChecked}">
                                <Calendar x:Name="calendar"                                  
                                          CalendarDayButtonStyle="{StaticResource CalendarDayButtonStyle}"              
                                          SelectedDate="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=SelectedDate}"
                                          DisplayDate="{TemplateBinding DisplayDate}"
                                          DisplayDateStart="{TemplateBinding DisplayDateStart}"
                                          DisplayDateEnd="{TemplateBinding DisplayDateEnd}">
                                    <Calendar.Triggers>
                                        <EventTrigger RoutedEvent="Calendar.SelectedDatesChanged">
                                            <EventTrigger.Actions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames 
                                                                        Storyboard.TargetName="openButton"
                                                                        Storyboard.TargetProperty="IsChecked">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <system:Boolean>False</system:Boolean>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger.Actions>
                                        </EventTrigger>
                                        <EventTrigger RoutedEvent="Calendar.MouseLeave">
                                            <EventTrigger.Actions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames 
                                                                        Storyboard.TargetName="openButton"
                                                                        Storyboard.TargetProperty="IsChecked">
                                                            <DiscreteObjectKeyFrame KeyTime="00:00:01">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <system:Boolean>False</system:Boolean>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger.Actions>
                                        </EventTrigger>
                                    </Calendar.Triggers>
                                </Calendar>
                            </Popup>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <DataTemplate x:Key="BacklogItemDataTemplate">

            <StackPanel Orientation="Vertical">
                <SF_Adorners:SurroundBorderAdorner
                    Background="{Binding Group.GroupColor}"
                    BorderBrush="LightGray"
                    AdornerLayerElement="{Binding ElementName=sprintPlansListBox}"
                    x:Name="itemBorder"
                   
                    Cursor="Hand"                                         
                    Width="115"                  
                    Margin="2,0,2,0"                   
                    ToolTipService.InitialShowDelay="0"
                    ToolTipService.BetweenShowDelay="0"
                    ToolTipService.Placement="MousePoint" 
                    Height="{Binding ItemTotalHoursInPixels}"
                    CornerRadius="3" BorderThickness="2" Padding="2">
                    <SF_Adorners:SurroundBorderAdorner.LeftControl>
                        <Border DataContext="{Binding ElementName=itemBorder, Path=DataContext}" Background="Transparent" Margin="0,0,-10,0" MinHeight="32">
                            <Button                                
                                Style="{StaticResource MoveItemLeftButton}"
                                VerticalAlignment="Center"                                           
                                Command="{Binding MoveItemToPreviousSprintCommand}" />
                        </Border>
                    </SF_Adorners:SurroundBorderAdorner.LeftControl>
                    <SF_Adorners:SurroundBorderAdorner.RightControl>
                        <Border DataContext="{Binding ElementName=itemBorder, Path=DataContext}" Background="Transparent" Margin="-10,0,0,0" MinHeight="32">
                            <Button                                
                                Style="{StaticResource MoveItemRightButton}"
                                VerticalAlignment="Center"                                                       
                                Command="{Binding MoveItemToNextSprintCommand}"/>

                        </Border>
                    </SF_Adorners:SurroundBorderAdorner.RightControl>
                    <SF_Adorners:SurroundBorderAdorner.ToolTip>
                        <TextBlock>                            
                            <Run Text="{Binding Item.BacklogItemNumber, StringFormat='{}[{0}]'}" FontWeight="Bold"/>
                            <Run Text="{Binding Item.Name}" FontWeight="Bold"/>               
                            <LineBreak/>
                            <Run Text="{Binding Item.CurrentTotalHours, Mode=OneWay, StringFormat={x:Static props:Resources.N_hrs}}"/>
                        </TextBlock>
                    </SF_Adorners:SurroundBorderAdorner.ToolTip>
                    <DockPanel Margin="0">
                        <TextBlock                 
                            Background="{Binding Group.GroupColor}"
                            Style="{StaticResource BacklogItemGroupTextBlock}"
                            DockPanel.Dock="Top"                                       
                            FontSize="{StaticResource TinyFontSize}" Padding="1"                                       
                            TextWrapping="Wrap"
                            LineStackingStrategy="BlockLineHeight"
                            Text="{Binding Item.Name}"                                                            
                            TextTrimming="CharacterEllipsis"/>
                        <TextBlock                 
                            Background="{Binding Group.GroupColor}"
                            Style="{StaticResource BacklogItemGroupTextBlock}"
                            DockPanel.Dock="Bottom"
                            HorizontalAlignment="Right" VerticalAlignment="Bottom"
                            FontSize="{StaticResource TinyFontSize}" Padding="1"                                                           
                            Text="{Binding Item.CurrentTotalHours, StringFormat={x:Static props:Resources.N_hrs}}"/>
                    </DockPanel>
                  
                </SF_Adorners:SurroundBorderAdorner>
                <Button Command="{Binding DataContext.ShiftItemsCommand, ElementName=thisView}" CommandParameter="{Binding Item}">                    
                    <Button.Style>
                        <Style TargetType="Button" BasedOn="{StaticResource CleanButton}">
                            <Setter Property="Button.Height" Value="4"/>
                            <Setter Property="Content" Value="{x:Null}"/>
                            <Style.Triggers>                                
                                <Trigger Property="Button.IsMouseOver" Value="True">
                                    <Setter Property="Button.Height" Value="15"/>
                                    <Setter Property="Button.Content">
                                        <Setter.Value>
                                            <Grid HorizontalAlignment="Stretch">
                                                <Rectangle HorizontalAlignment="Stretch" Height="2" Stroke="Gray" StrokeDashArray="3,3" StrokeThickness="2" />
                                                <TextBlock Text="{x:Static props:Resources.Break}" Background="White" FontSize="{StaticResource TinyFontSize}" TextAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" Foreground="Gray"/>
                                            </Grid>
                                        </Setter.Value>
                                    </Setter>                                    
                                </Trigger>
                                <Trigger Property="Button.IsEnabled" Value="False">
                                    <Setter Property="Button.Visibility" Value="Hidden"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                </Button>
            </StackPanel>
                
            
             


            
        </DataTemplate>

    </UserControl.Resources>

    <SF_Helpers:PanelLayout Title="{Binding PanelName}"
                            SF_Comp:CommandBehavior.RoutedEventName="Loaded"
                            SF_Comp:CommandBehavior.TheCommandToRun="{Binding LoadDataCommand}">

        <!-- TOOLBAR -->
        <SF_Helpers:PanelLayout.Toolbar>

            <ToolBar Grid.Row="0">
                <MenuItem Header="{x:Static props:Resources.Add_sprint}" Command="{Binding CreateNewSprintCommand}" Style="{StaticResource Toolbar_MenuItemStyleHideWhenDisabled}" >
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/Add.png" Width="32" Height="32" Stretch="Uniform"/>
                    </MenuItem.Icon>
                </MenuItem>
             
                <MenuItem Header="{x:Static props:Resources.Equalize}" Command="{Binding EqualizeSprintsCommand}" Style="{StaticResource Toolbar_MenuItemStyleHideWhenDisabled}">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/Equalize.png" Width="32" Height="32" Stretch="Uniform"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static props:Resources.Schedule_report}" Command="{Binding ShowDeliveryReportCommand}">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/preview.png" Width="32" Height="32" Stretch="Uniform"/>
                    </MenuItem.Icon>
                </MenuItem>

                <ItemsControl Style="{StaticResource PluginMenuItems}" />

            </ToolBar>

        </SF_Helpers:PanelLayout.Toolbar>

        <!-- CONTENT -->
        <SF_Helpers:PanelLayout.Content>
            
            <Viewbox StretchDirection="DownOnly" Stretch="Uniform" HorizontalAlignment="Left" VerticalAlignment="Top">
                <Grid x:Name="sprintGrid">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    
                    <StackPanel Orientation="Vertical" Margin="0,0,6,0" Grid.Column="0">
                        
                        <TextBlock 
                                Foreground="{StaticResource TitleTextBrush}"
                                FontWeight="Bold" Width="120" Height="80"
                                TextWrapping="Wrap" VerticalAlignment="Center"
                                Text="{x:Static props:Resources.Previous_sprint_items}"/>
                        
                        <ListBox
                            x:Name="notFinishedItemsListBox"
                            BorderThickness="0"
                            Background="Transparent"                    
                            ItemContainerStyle="{StaticResource NoHoverListBoxItem}"
                            ItemTemplate="{StaticResource BacklogItemDataTemplate}"
                            ItemsSource="{Binding LateItemsSprint.PlannedItems}"
                            SF_DD:DragDropHelper.IsDragSource="True"   
                            SF_DD:DragDropHelper.OnDropCommand="{Binding ElementName=thisView, Path=Model.MoveItemToCommand}"                                            
                            SF_DD:DragDropHelper.DragDropTemplate="{StaticResource BacklogItemDataTemplate}"/>

                        <StackPanel.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding ElementName=notFinishedItemsListBox, Path=HasItems}" Value="False">
                                        <Setter Property="StackPanel.Visibility" Value="Collapsed"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </StackPanel.Style>


                    </StackPanel>




                    <ListBox        
                        x:Name="sprintPlansListBox"
                        Margin="0,0,0,20"
                        Grid.Column="1"
                                               
                        ScrollViewer.VerticalScrollBarVisibility="Disabled"
                        ScrollViewer.CanContentScroll="False" 
                        ItemContainerStyle="{StaticResource NoHoverListBoxItem}"
                        BorderThickness="0"                                
                        ItemsSource="{Binding SprintPlans}">

                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Expander IsExpanded="True" Style="{StaticResource SprintHeaderExpander}">

                                    <StackPanel Orientation="Vertical" >

                                        <Border Style="{StaticResource SprintHeaderBorder}">
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition />
                                                    <ColumnDefinition />
                                                </Grid.ColumnDefinitions>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="auto" />
                                                    <RowDefinition Height="auto"/>
                                                    <RowDefinition Height="auto"/>
                                                </Grid.RowDefinitions>


                                                <TextBlock                                  
                                        Grid.ColumnSpan="2" Grid.RowSpan="3"
                                        FontSize="36"
                                        Foreground="LightGray" HorizontalAlignment="Center" VerticalAlignment="Center"                                                                                      
                                    Text="{Binding Sprint.SprintNumber}"/>

                                                <TextBlock 
                                Grid.Row="0" Grid.ColumnSpan="2"
                                FontStyle="Italic" FontSize="{StaticResource SmallFontSize}" HorizontalAlignment="Right"
                                Foreground="Black" Margin="0,0,0,0" >
                                <TextBlock Text="{Binding TotalHours, Mode=OneWay, StringFormat={x:Static props:Resources.N_hrs}}"/><Run Text=","/>
                                <Run Text="{Binding Sprint.WorkDayCount, Mode=OneWay, StringFormat={x:Static props:Resources.N_days}}"/>
                            </TextBlock>

                                                <Image                                                                          
                                Grid.Row="1" Grid.ColumnSpan="2"
                                Source="/Images/Toolbar/teamMemberMeter.png"
                                Stretch="None"                                            
                                Height="16" HorizontalAlignment="Right" MaxWidth="128" Margin="0,8,0,5"
                                Width="{Binding NumberOfMembersNeededForDoItInPixels}">
                                                    <Image.ToolTip>
                                                        <TextBlock Text="{Binding NumberOfMembersNeededForDoIt, StringFormat={x:Static props:Resources.You_will_need_N_guys_to_perform_this_sprint}}" />
                                                    </Image.ToolTip>
                                                </Image>





                                                <Calendar
                                Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Bottom"
                                DisplayDate="{Binding Sprint.StartDate, Mode=OneTime}"
                                FontSize="{StaticResource SmallFontSize}" FontWeight="Normal"
                                SelectedDate="{Binding SprintStartDate, UpdateSourceTrigger=PropertyChanged}">
                                                    <Calendar.Style>
                                                        <Style BasedOn="{StaticResource SprintDatePicker}" TargetType="{x:Type Calendar}">
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding ElementName=thisView, Path=Model.UserCannotEdit}" Value="True">
                                                                    <Setter Property="IsEnabled" Value="False"/>
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Calendar.Style>
                                                </Calendar>

                                                <Calendar
                                Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"
                                DisplayDate="{Binding Sprint.StartDate, Mode=OneTime}"
                                DisplayDateStart="{Binding Sprint.StartDate, Mode=OneTime}"              
                                FontSize="{StaticResource BigFontSize}" FontWeight="Bold"
                                SelectedDate="{Binding SprintEndDate, UpdateSourceTrigger=PropertyChanged}">
                                                    <Calendar.Style>
                                                        <Style BasedOn="{StaticResource SprintDatePicker}" TargetType="{x:Type Calendar}">
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding ElementName=thisView, Path=Model.UserCannotEdit}" Value="True">
                                                                    <Setter Property="IsEnabled" Value="False"/>
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Calendar.Style>
                                                </Calendar>



                                                <DockPanel Grid.ColumnSpan="2" Grid.RowSpan="3" HorizontalAlignment="Right" VerticalAlignment="Top">
                                                    <Button                                                                                                                                    
                                    Style="{StaticResource RemoveActionButton}"                                             
                                    Command="{Binding ElementName=thisView, Path=Model.RemoveSprintCommand}"
                                    CommandParameter="{Binding .}"/>
                                                    <DockPanel.Style>
                                                        <Style>
                                                            <Setter Property="DockPanel.Visibility" Value="Collapsed"/>
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type Border}}}" Value="True">
                                                                    <Setter Property="DockPanel.Visibility" Value="Visible"/>
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </DockPanel.Style>
                                                </DockPanel>

                                            </Grid>

                                        </Border>

                                        <Grid VerticalAlignment="Top" Margin="0,3,0,0">
                                            <Rectangle
                                                HorizontalAlignment="Stretch" 
                                                Stroke="Gray" StrokeDashArray="3,3" StrokeThickness="2" RadiusX="3" RadiusY="3"/>

                                            
                                                <TextBlock 
                                                    Text="{x:Static props:Resources.Drop_items_here}" 
                                                    TextWrapping="Wrap" TextAlignment="Center"
                                                    VerticalAlignment="Center" HorizontalAlignment="Center"
                                                    Width="80" Foreground="LightGray" Margin="5">
                                                    <TextBlock.Style>
                                                        <Style>
                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed"/>
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding Items.Count, ElementName=sprintList}" Value="0">
                                                                    <Setter Property="TextBlock.Visibility" Value="Visible"/>
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </TextBlock.Style>
                                                </TextBlock>
                                                

                                            <ListBox
                                                ClipToBounds="False"
                                                x:Name="sprintList"
                                                BorderThickness="0"      
                                                Margin="0,2,0,2"                               
                                                Background="Transparent" VerticalAlignment="Stretch"
                                                
                                                SF_DD:DragDropHelper.OnDropCommand="{Binding ElementName=thisView, Path=Model.MoveItemToCommand}"                                            
                                                SF_DD:DragDropHelper.IsDropTarget="True"
                                                SF_DD:DragDropHelper.DragDropTemplate="{StaticResource BacklogItemDataTemplate}"
                                            
                                                Tag="{Binding Sprint.SprintNumber}"
                                                
                                                SF_Helpers:ItemActivation.ActivationMode="Both"
                                                SF_Helpers:ItemActivation.TheCommandToRun="{Binding DataContext.ShowDetailCommand, ElementName=thisView}"
                                                                                        
                                                ItemTemplate="{StaticResource BacklogItemDataTemplate}"
                                                ItemsSource="{Binding PlannedItems}">
                                                <ListBox.ItemContainerStyle>
                                                    <Style BasedOn="{StaticResource NoHoverListBoxItem}" TargetType="{x:Type ListBoxItem}">
                                                        <Setter Property="SF_DD:DragDropHelper.IsDragAllowed" Value="{Binding IsDevelopmentItem}"/>
                                                    </Style>
                                                </ListBox.ItemContainerStyle>
                                                <ListBox.Style>
                                                    <Style>
                                                        <Setter Property="SF_DD:DragDropHelper.IsDragSource" Value="True"/>
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding ElementName=thisView, Path=Model.UserCannotEdit}" Value="True">
                                                                <Setter Property="SF_DD:DragDropHelper.IsDragSource" Value="False"/>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </ListBox.Style>
                                            </ListBox>




                                        </Grid>

                                    </StackPanel>

                                </Expander>

                            </DataTemplate>
                        </ListBox.ItemTemplate>
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                    </ListBox>

                    <ContentControl Grid.ColumnSpan="2" Grid.Row="0"                                            
                        Style="{StaticResource LoadingAnimationContent}"/>

                    
                 

                </Grid>
            </Viewbox>
            
                
            
            

        </SF_Helpers:PanelLayout.Content>
        
    </SF_Helpers:PanelLayout>
    
</UserControl>
